package yja.gzw.app.adapter

import android.content.Context
import android.content.Intent
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import yja.gzw.app.R
import yja.gzw.app.activity.ShengqingxiangqingActivity
import yja.gzw.app.model.bean.DataItemspzt
import yja.gzw.app.model.bean.OrderInfoBean

class ShengqingAdapter (private val context: Context, private val list: List<DataItemspzt>): RecyclerView.Adapter<RecyclerView.ViewHolder>(){
    private var view: View?=null
    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
        view= LayoutInflater.from(parent.context).inflate(R.layout.item_view_shengqing,parent,false)
        return ViewHodeView(view!!)
    }

    override fun getItemCount(): Int {
       return list.size
    }

    override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {

        if(holder is ViewHodeView){
           holder. shengqingbiaoti.text= list[position].status_text

            holder. yuanying.text= list[position].remark
            holder. shijian.text= list[position].createtime

            holder.itemView.setOnClickListener {

                val intent= Intent(context, ShengqingxiangqingActivity::class.java)

                        intent.putExtra("idids", list[position].id.toString())
                context.startActivity(intent)
            }


        }



    }
    inner class ViewHodeView(itemView: View):RecyclerView.ViewHolder(itemView){
       val shengqingbiaoti: TextView =itemView.findViewById(R.id.shengqingbiaoti)
        val yuanying: TextView =itemView.findViewById(R.id.yuanying)
        val shijian: TextView =itemView.findViewById(R.id.shijian)

    }


}